summaryrefslogtreecommitdiff
path: root/app/[lng]/evcp/(evcp)/(master-data)/docu-list-rule/[projectId]/code-groups/page.tsx
blob: c75bf6b93df508d7d15548bf233104da009e9bdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import * as React from "react";
import { type SearchParams } from "@/types/table";
import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton";
import { getCodeGroups } from "@/lib/docu-list-rule/code-groups/service";
import { CodeGroupsTable } from "@/lib/docu-list-rule/code-groups/table/code-groups-table";
import { searchParamsCodeGroupsCache } from "@/lib/docu-list-rule/code-groups/validation";


interface IndexPageProps {
  searchParams: Promise<SearchParams>;
  params: Promise<{ lng: string; projectId: string }>;
}

export default async function IndexPage(props: IndexPageProps) {
  const searchParams = await props.searchParams;
  const { projectId } = await props.params;
  
  // 프로젝트 ID를 필터에 추가
  const searchParamsWithProject = {
    ...searchParams,
    projectId: projectId
  };
  
  const search = searchParamsCodeGroupsCache.parse(searchParamsWithProject);

  const promises = Promise.all([
    getCodeGroups({
      ...search,
    }),
  ]);

  return (
    <>


      <React.Suspense
        fallback={
          <DataTableSkeleton
            columnCount={7}
            searchableColumnCount={1}
            filterableColumnCount={2}
            cellWidths={["8rem", "12rem", "10rem", "10rem", "12rem", "8rem", "12rem"]}
            shrinkZero
          />
        }
      >
        <CodeGroupsTable promises={promises} />
      </React.Suspense>
    </>
  );
}